<template>
  <el-form :model="model" ref="parkingMagForm" :inline="true" label-width="72px" :label-position="'left'">
  <el-row class="search-title">条件搜索</el-row>
  <el-form-item prop="park_name">
    <el-input v-model="model.park_name" prefix-icon="el-icon-search" placeholder="停车场名称/拼音首字母" clearable></el-input>
  </el-form-item>
  <el-form-item>
    <el-button class="btn-search" type="primary" @click="handleQueryParkingMag">搜索</el-button>
  </el-form-item>
  <collapse-vertical>
    <div v-show="isDisplay">
      <div>
        <el-form-item prop="park_no" label="车场编号">
          <el-input v-model="model.park_no" placeholder="请输入停车场编号" clearable></el-input>
        </el-form-item>
        <el-form-item prop="park_ssdw" label="所属单位">
          <el-input v-model="model.park_ssdw" placeholder="请输入所属单位" readonly @click.native="handleDwSelect"></el-input>
        </el-form-item>
        <el-form-item prop="park_jdbsc" label="街道办事处">
          <el-input v-model="model.park_jdbsc" placeholder="请输入街道办事处" clearable></el-input>
        </el-form-item>
        <el-form-item prop="park_road" label="所在道路">
          <el-input v-model="model.park_road" placeholder="请输入所在道路" clearable></el-input>
        </el-form-item>
        <el-form-item prop="park_sroad" label="起始道路">
          <el-input v-model="model.park_sroad" placeholder="请输入起始道路" clearable></el-input>
        </el-form-item>
        <el-form-item prop="park_eroad" label="终止道路">
          <el-input v-model="model.park_eroad" placeholder="请输入终止道路" clearable></el-input>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="park_sfbz" label="收费标准">
          <el-radio-group v-model="model.park_sfbz" size="small">
            <el-radio   v-for="(item,ids) in sfbzs" :key="ids" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="park_status" label="停车场状态">
          <el-radio-group v-model="model.park_status" size="small">
            <el-radio   v-for="(item,ids) in parkstatuss" :key="ids" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <div>
        <el-form-item prop="park_roadkind" label="是否示范路">
          <el-radio-group v-model="model.park_roadkind" size="small">
            <el-radio   v-for="(item,ids) in roadkinds" :key="ids" :label="item.id" >{{item.value}}</el-radio>
          </el-radio-group>
        </el-form-item>
      </div>
      <el-form-item prop="park_date" label="选择日期">
        <el-date-picker v-model="model.park_date" type="date" placeholder="请选择日期" clearable format="yyyy 年MM 月dd 日"
         value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button class="btn-mini-form" @click="handleQueryParkingMag"
                   size="mini">提交
        </el-button>
        <el-button class="btn-mini-form" @click="handleResetParkingMag"
                   size="mini">重置
        </el-button>
      </el-form-item>
    </div>
  </collapse-vertical>
  <el-row style="text-align: center"><el-button style="border: none;background-color: transparent" size="small" @click="isShow" :icon="isDisplay?'el-icon-arrow-up':'el-icon-arrow-down'"></el-button></el-row>
  <person-child-dialog-dw :dialogDwVisible.sync="dialogDwVisibleParkingMag" @dwName="selectDwnameParkingMag" :dwType="0"></person-child-dialog-dw>
  </el-form>
</template>

<script>
  /* eslint-disable */
  import PersonChildDialogDw from "../../organizationManagement/personChild/personChildDialogDw";
  import ElFormItem from "element-ui/packages/form/src/form-item";
  import {selDictonary} from "../../../api/dictionary";
  import {getChargeStandard} from "../../../api/parkingResource/parkingMag";
  import CollapseVertical from '../../../utils/collapseVertical'

  export default {
    components: {
      ElFormItem,
      PersonChildDialogDw,
      CollapseVertical
    },
    name: "parking-mag-form",
    created() {
      this.initData()
    },
    data() {
      return {
        dialogDwVisibleParkingMag: false,
        isDisplay: false,
        model: {
          park_date: '',
          park_eroad: '',
          park_jdbsc: '',
          park_name: '',
          park_no: '',
          park_road: '',
          park_roadkind: '',
          park_sroad: '',
          park_ssdw: '',
          park_status: '',
          park_sfbz: ''
        },

        sfbzs: [],
        parkstatuss: [],
        roadkinds: []
      }
    },
    methods: {
      handleQueryParkingMag() {
        this.$emit('handleQueryParkingMag', this.model)
      },
      handleResetParkingMag() {
        this.$refs['parkingMagForm'].resetFields()
      },
      handleDwSelect() {
        this.dialogDwVisibleParkingMag = true
      },
      selectDwnameParkingMag(val) {
        this.model.park_ssdw = val.orgname
      },
      initData() {
        selDictonary().then(res => {
          for (var item in res) {
            if (res[item].id == "roadkind") {//
              this.roadkinds = res[item].comboboxDetailList
            } else if (res[item].id == "enableflag") {
              this.parkstatuss = res[item].comboboxDetailList
            }
          }
        })
        getChargeStandard().then(res => {
          this.sfbzs = res
        })
      },
      isShow(){
        this.isDisplay =!this.isDisplay
      }

    }
  }
</script>

<style scoped>

</style>
